import yaml
import os

MASTER_CONFIG_FILE = os.path.join('config', 'master.yaml')


# 主人身份的保存
def save_master(master_id):
  config = {"master": master_id}
  with open(MASTER_CONFIG_FILE, "w") as file:
    yaml.dump(config, file)


# 主人身份的加载
def load_master():
  with open(MASTER_CONFIG_FILE, "r") as file:
    config = yaml.safe_load(file)
    return config["master"]


# 主人身份的判断
def is_master(message):
  return str(message.author.id) == load_master()
